package com.jiangtour.dto;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.jiangtour.enums.OrderStatusEnum;
import com.jiangtour.utils.EnumUtil;
import com.jiangtour.utils.serializer.Date2LongSerializer;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;

/**
 * @author Administrator
 * @Title: OrderDTO
 * @ProjectName site
 * @Description: 订单信息
 * @date 2018/12/27/02717:55
 */
@Data
public class OrderDTO {
    /** 订单id. */
    private String orderId;

    /** 买家名字. */
    private String buyerName;

    /** 买家手机号. */
    private String buyerPhone;

    /** 买家地址. */
    private String buyerAddress;


    /** 订单总金额. */
    private BigDecimal orderAmount;

    /** 订单状态, 默认为0新下单. */
    private Integer orderStatus;

    /** 取件点 **/
    private Integer pickUpParts;
    private String pickUpPartsName;

    /** 快递公司**/
    private Integer expressCompany;
    private String expressName;
    /** 归属学校**/
    private String ascriptionId;
    /** 栋号**/
    private  Integer floorNumber;
    /** 附件信息**/
    private  String additional;
    /**备注**/
    private  String remarks;//备注

    private Integer specId;//规格

    private String specName;//规格名称

    private Integer orderType;//寄件 收件标识

    /** 取件信息 寄件和收件 区别**/
    private String addressee;//收件人

    private String addresseePhone;//收件人电话

    private String addresseeAddress;//收件人地址

    private  String additionalInfo;//附件信息(代取件填写)

    public OrderDTO(String specName, String buyerName, String buyerPhone) {
        this.specName=specName;
        this.buyerName=buyerName;
        this.buyerPhone=buyerPhone;
    }

    public OrderDTO() {

    }

    @JsonIgnore
    public OrderStatusEnum getOrderStatusEnum() {
        return EnumUtil.getByCode(orderStatus, OrderStatusEnum.class);
    }

    @JsonSerialize(using = Date2LongSerializer.class)
    private Date createTime;

    @JsonSerialize(using = Date2LongSerializer.class)
    private  Date updateTime;


}
